<extend name="Public:innerbase" />
<block name="js">
<include file="Public:upload" />
</block>
<block name="content">
<div class="container-fluid">
	<div class="page-header wm-page-header">
		<h4>修改相册</h4>
		<a href="{:U('Photo/index')}" class="btn btn-default btn-sm">
			<span class="glyphicon glyphicon-chevron-left"></span>&nbsp;返回
		</a>
	</div>
	<form class="form-horizontal" action="" method="post">
		<input type="hidden" name="id" value="{$photo.id}" />
		<div class="form-group">
			<label class="col-sm-2">相册名称</label>
			<div class="col-md-4">
				<input type="text" name="title" value="{$photo.title}" class="form-control" id="name" onkeyup="DivFollowingText1()" />
			</div>
			<span class="text-info col-md-2">尽量简单，不要超过20字</span>
		</div>
		<div class="form-group">
			<label class="col-sm-2">相册封面</label>
			<div class="col-sm-6" >
				<input type="hidden" class="form-control" value="{$photo.picurl}" id="img" name="picurl" />
				<img id="imgHolder" style="width:216px;height:120px;" class="img-rounded" <if condition="$photo['picurl'] eq ''">src="{:RES}/images/photo/noneimg.jpg"</if> src="{$photo.picurl}"/>
				<div class="btn-group" style="vertical-align:bottom;">
					<span class="btn btn-xs btn-primary" onclick="selectAsset('img',720,400)">
						<span class="glyphicon glyphicon-cloud-upload"></span>选择
					</span>
					<span class="btn btn-primary btn-xs" onclick="previewImg('img')">
						<span class="glyphicon glyphicon-picture"></span>预览
					</span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2">相册简介</label>
			<div class="col-md-4">
				<textarea class="form-control" id="info" name="info" style="height:120px">{$photo.info}</textarea>
			</div>
			<span class="text-info col-md-4">请简单描述相册内容，尽量控制在150文字以内</span>
		</div>
		<div class="form-group">
			<label class="col-sm-2">&nbsp;</label>
			<div class="col-md-1">
				<div class="radio">
					<label>显示<input type="radio" name="status" value="1" <if condition="!$info OR ($info['status'] eq 1)">checked</if>/></label>
				</div>
			</div>
			<div class="col-md-1">
				<div class="radio">
					<label>不显示<input type="radio" name="status" value="0" <if condition="$info AND($info['status'] eq 0)">checked</if>/></label>
				</div>
			</div>
		</div>
        <div class="form-group">
            <label class="col-sm-2">排序</label>
            <div class="col-md-4">
                <input type="text" name="sort" value="{$photo.sort}" class="form-control" id="sort" />
            </div>
            <span class="text-info col-md-2">从小到大进行排序</span>
        </div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<button type="submit" class="btn btn-primary">保存</button>
			</div>
		</div>
	</form>
</div>
</block>

<div class="content">
   
    <form method="post" action="">
         <div class="msgWrap bgfc">
            <table class="userinfoArea" style=" margin:0;" border="0" cellspacing="0" cellpadding="0" width="100%"><tbody>
<tr>
<th valign="top"><span class="red">*</span>相册名称：</th>
<td width="430"><input type="text" name="title" value="{$photo.title}" class="px" style="width:400px;" id="name" onkeyup="DivFollowingText1()">

<br>
.</td>
<td width="430" rowspan="4" valign="top" class="chatPanel" style="padding:0px;">


<!--完整显示所有内容的效果-->	
<div class="chatItem you" id="photo1" style="width:350px;" <if condition="$photo['isshowinfo'] eq 1">display:none<else/> </if>> 
  　<a target="ddd" href="">
<div class="media mediaFullText">

<div class="mediaPanel">
<div class="mediaHead"><span class="title" id="zname">{$photo.title}</span>
</div>
<div class="mediaImg"><img id="pic_src" src="{$photo.picurl}"></div>
<div class="mediaContent mediaContentP">
<p id="zinfo">{$photo.info}</p>
</div>
<div class="mediaFooter">
<span class="mesgIcon right"></span><span style="line-height:50px;" class="left">查看全文</span>
<div class="clr"></div>
</div>
</div>
</div>
</a>
</div>

<!--最简单的显示效果-->	
<div class="chatItem you" id="photo2" style="<if condition="$photo['isshowinfo'] eq 0">display:none<else/> </if>"> 
  　<a target="ddd" href="">
<div class="media mediaFullText">

<div class="mediaPanel">
<div class="mediaHead" style="padding: 10px 10px 0px;">
</div>
<div class="mediaImg"><img id="zpic2" src="{$photo.picurl}"/></div>
<div class="mediaFooter">
<span class="mesgIcon right"></span>
<span style="line-height:50px; font-size:16px" id="zname2">{$photo.title}</span>
<div class="clr"></div>
</div>
</div>
</div>
</a>
</div>


</td>

</tr>
<tr>
<th valign="top">
<span class="red">*</span>相册封面图：</th>
<input type="hidden" name="id" value="{$photo.id}" />
<td width="430">
	<input type="text" name="picurl" value="{$photo.picurl}" class="px" style="width:400px;" id="pic" onblur="document.getElementById('pic_src').src=document.getElementById('pic').value;document.getElementById('zpic2').src=document.getElementById('pic').value;" onchange="document.getElementById('pic_src').src=document.getElementById('pic').value;document.getElementById('zpic2').src=document.getElementById('pic').value;"><br>
	<a href="javascript:void(0)" onclick="selectAsset('pic',700,420)" class="a_upload">上传</a> 
	<a href="javascript:void(0)" onclick="previewImg('pic')">预览</a>
</tr>
<tr>
   <th valign="top">相册介绍：</th>
	<td valign="top">
		<textarea class="px" id="info" name="info" style="width:400px; height:120px" onkeyup="DivFollowingText2()">{$photo.info}</textarea><br>
			<script type="text/javascript">
			function DivFollowingText2()
			{
			document.getElementById("zinfo").innerHTML=document.getElementById("info").value;
			}
		</script> 
		请简单描述相册内容，尽量控制在<span class="red">150文字以内</span>。<br>
		<label>
			<input name="isshowinfo" <if condition="$photo['isshowinfo'] eq 0">checked="checked"</if> type="radio" id="RadioGroup0_0" value="0" checked="checked" onclick="document.getElementById('photo2').style.display='none';document.getElementById('photo1').style.display='';">
			显示简介
		</label>　　
		<label>
			<input type="radio" <if condition="$photo['isshowinfo'] eq 1">checked="checked"</if> name="isshowinfo" value="1" id="RadioGroup0_1" onclick="document.getElementById('photo1').style.display='none';document.getElementById('photo2').style.display='';">
			不显示简介
		</label>	
	</td>
</tr>
<tr>
<th valign="top">是否显示：</th>
	<td valign="top">
	<select name="status">
	<option value="1" <if condition="$photo['status'] eq 1"> selected</if>>显示此相册</option>
	<option value="0" <if condition="$photo['status'] eq 0"> selected</if>>不显示此相册</option>
	</select>						
	                       	
	</td>
</tr>
<tr>
	<th valign="top">&nbsp;</th>
	<td>
		<button type="submit" name="button" class="btnGreen">保存</button>
		<a href="index.php?ac=photo-list&amp;id=9878" class="btnGray vm">取消</a></td>
		<td>&nbsp;
	</td>
</tr>
</tbody>
</table>
            
          </div>
          </form>
          
        </div>
				<script type="text/javascript">
var selUser = {};

function addvotetouser(obj, type) {
var liid = 'votetouser_' + type + '_' + obj.value;
var userObj = $('vote_user_'+type);
if(obj.checked) {
if($(liid) == null) {
var newli = document.createElement("li");
newli.id = liid;

//创建隐含域
try {
var InputNode = document.createElement("<input type=\"hidden\" value=\""+ obj.value +"\" name=\"votetouser["+type+"]["+obj.getAttribute('user')+"]\">");
} catch(e) {
var InputNode = document.createElement("input");
InputNode.setAttribute("name", "votetouser["+type+"][]");
InputNode.setAttribute("type", "hidden");
InputNode.setAttribute("value", obj.value);
}
newli.appendChild(InputNode);
var newspan = document.createElement("span");
newspan.innerHTML ='<p>' + obj.getAttribute('user')+'</p> <a href="javascript:;" onclick="delSelUser(\''+liid+'\', \''+obj.value+'\');" title="删除" class="deltw">删除</a>';
newli.appendChild(newspan);
userObj.appendChild(newli);
selUser[obj.value] = obj.value;
}
} else {
userObj.removeChild($(liid));
delete selUser[obj.value];
}
}
function delSelUser(lid, uid) {
delete selUser[uid];
$(lid).parentNode.removeChild($(lid));
}

function setFlag(obj, utype) {
var uids = common = '';
obj.href = ''+utype;
for(var key in selUser) {
if(parseInt(selUser[key])) {
uids = uids + common + selUser[key];
common = ',';
}
}
if(uids != '') {
obj.href += '&uids=' +  uids;
}
}
</script>
</body>
</html>
 